<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/sys/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改文章信息</title>
<%@ include file="/WEB-INF/sys/include/css.jsp"%>
<link href="${path}/res/js/webuploader/webuploader.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form" action="${path }/cms/article/update.json" method="post">
<div class="form">
	<div class="title">修改文章信息</div>
	<div class="group">
		<div class="label">*文章标题:</div>
		<div class="item"><input type="text" name="articleTitle" id="articleTitle" value="${article.articleTitle}" maxlength="20" /></div>
	</div>
	<div class="group">
		<div class="label">*关键字:</div>
		<div class="item"><input type="text" name="keyWord" id="keyWord" value="${article.keyWord}" maxlength="20" /></div>
	</div>
	<div class="group">
		<div class="label">所属园区:</div>
		<div class="item">
			<input type="text" id="parkName" name="parkName" />
			<input type="hidden" name="parkid" id="parkid" value="${article.parkid}"/>
		</div>
		<div class="item" id="parkNameTip"></div>
	</div>
	<div class="group">
		<div class="label">文章图片:</div>
		<div class="item"><div id="thumb" class="myuploader myuploader-single">${article.thumb}</div></div>
	</div>
	<div class="group">
		<div class="label">是否轮播:</div>
		
		<div class="item"><input type="checkbox" name="carousel" id="carousel" value="1" <c:if test="${article.carousel == 1 }">checked="checked"</c:if>/></div>
	</div>
	<div class="group">
		<div class="label">*文章简介:</div>
		<div class="item"><textarea id="articleDesc" name="articleDesc">${article.articleDesc}</textarea></div>
	</div>
	<div class="group" style="overflow: visible;">
		<div class="label">*文章内容:</div>
		<div class="item">
			<script id="articleContent" name="articleContent" type="text/plain" style="width:800px;height:300px;">${article.articleContent}</script>
		</div>
	</div>
	<div class="group">
		<div class="label">文章附件:</div>
		<div class="item"><div id="cmsArticleAttachments" class="myuploader">${attachments}</div></div>
	</div>
	<div class="buttons">
		<button class="highlight" id="submit1" type="button">确定</button>
		<button type="button" id="cancel1">取消</button>
		<input type="hidden" id="articleId" name="articleId" value="${article.articleId}" />
	</div>
</div>
</form>

<%@ include file="/WEB-INF/sys/include/script.jsp" %>
<script type="text/javascript" src="${path}/res/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="${path}/res/js/ueditor/ueditor.all.min.js"></script>
<script src="${path}/res/js/webuploader/webuploader.min.js" type="text/javascript"></script>
<script src="${path}/res/js/webuploader/myUploader.js" type="text/javascript"></script>
<script type="text/javascript">
var myuploader,attachmentsmyuploader;
$(function(){
	myuploader = $("#thumb").myImgUploader({
		uploadDir: "news_img"
	});
	attachmentsmyuploader = $("#cmsArticleAttachments").myUploader({
		uploadDir: "cms_attachment",
		type: "attachment",
		canEditDesc:true
	});
	createSelect("parkName", "parkid", {
		valueField:'parkid', textField: 'parkName',
		url:'${path}/inspection/item/getParkData.json'
	});
	ue = UE.getEditor('articleContent', {});
	$("#form").ligerForm({inputWidth: 300});
	
	verifyForm("form", {}, function(){
		$("#form").ajaxForm(function(data){
			UiUtil.isSuccess(data, "修改文章信息成功", function(){
				UiUtil.closeForm(true);
			});
		});
	});
	
	$("#submit1").click(function(){
		UiUtil.lockButton('submit1');
		if(!myuploader.isDone()||!attachmentsmyuploader.isDone()){
			UiUtil.unlockButton('submit1');
			return
		}
		$("#form").submit();
	});

	$("#cancel1").click(function(){
		UiUtil.closeForm();
	});
});
</script>
</body>
</html>